package com.cncsi.service;

import com.cncsi.dao.MenuRepositoty;
import com.cncsi.dao.OrderRepositoty;
import com.cncsi.dao.RestaurantRepository;
import com.cncsi.entity.Menu;
import com.cncsi.entity.Restaurant;
import com.cncsi.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * Created by 1N on 2018/9/12.
 */
@Service
@Transactional
public class MenuService {
    @Autowired
    private MenuRepositoty menuRepositoty;
    @Autowired
    private RestaurantRepository restaurantRepository;

    @Autowired
    private RestaurantService restaurantService;
    public List<Menu> getMenu(){
        List<Menu> menuList = menuRepositoty.findAll();
        return menuList;
    }

//    public String saveMenu(Menu menu){
//       Restaurant restaurant = restaurantService.getResaaurantForOne(Integer menu.getRestaurant());
//        menu.setRestaurant(restaurant);
//        try {
//            menuRepositoty.save(menu);
//            return "success";
//        }catch (Exception e){
//            return "fail";
//        }
//    }

}
